package com.zz.ai.controller;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.ollama.api.OllamaModel;
import org.springframework.ai.ollama.api.OllamaOptions;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OllamaController {

//    @Resource
//    private OllamaChatModel ollamaChatModel;

    @Resource
    private ChatClient chatClient;

    @RequestMapping(value = "/ai/ollama")
    public Object ollama(@RequestParam(value = "msg")String msg){

        String called=chatClient.prompt(msg).functions("askForLeave","payLimitForAsk","getHotelAddress").call().content();
//        System.out.println(called);
        return called;
    }


    @RequestMapping(value = "/ai/ollama2")
    public Object ollama2(@RequestParam(value = "msg")String msg){


        return "";
    }

}
